Imports System.Reflection
Imports System.Data.OleDb
Imports RIBS.DataAccessLayer

Namespace BusinessLogicLayer
    Public Class SystemObjects

        Public Shared Function GetActions(Optional ByVal bClosed As Boolean = False) As DataTable
            Try
                Dim DBLayer As New DataAccess
                Return DBLayer.GetActions(bClosed)
            Catch ex As Exception
                Throw ex
            Finally

            End Try
        End Function

        Public Shared Function GetUsers(Optional ByVal HideAdmin As Boolean = False) As DataTable
            Try
                Dim DBLayer As New DataAccess
                Return DBLayer.GetUsers(HideAdmin)
            Catch ex As Exception
                Throw ex
            End Try
        End Function

        Public Shared Function GetUserMainFilter(ByVal UserID As String) As String
            Try
                Dim DBLayer As New DataAccess
                Dim MainFilter As String = DBLayer.GetUserProperties(UserID).Rows(0).Item(Globals.UserProperties.MainFilter).ToString
                If IsDBNull(MainFilter) Then MainFilter = ""
                Return MainFilter
            Catch ex As Exception
                Throw ex
            Finally

            End Try
        End Function

        Public Shared Function GetUserTaskFilter(ByVal UserID As String) As String
            Try
                Dim DBLayer As New DataAccess
                Dim TaskFilter As String = DBLayer.GetUserProperties(UserID).Rows(0).Item(Globals.UserProperties.TaskFilter.ToString).ToString
                If IsDBNull(TaskFilter) Then TaskFilter = ""
                Return TaskFilter
            Catch ex As Exception
                Throw ex
            Finally

            End Try
        End Function

        Public Shared Function GetUserFilters(ByVal UserID As String) As String
            Try
                Dim DBLayer As New DataAccess
                Dim dt As DataTable = DBLayer.GetUserProperties(UserID)
                Dim Filters As String = dt.Rows(0).Item(Globals.UserProperties.MainFilter.ToString).ToString
                If IsDBNull(Filters) Then Filters = ""
                Filters += "|"
                If Not IsDBNull(dt.Rows(0).Item(Globals.UserProperties.TaskFilter.ToString).ToString) Then
                    Filters += dt.Rows(0).Item(Globals.UserProperties.TaskFilter.ToString).ToString
                End If
                Return Filters
            Catch ex As Exception
                Throw ex
            Finally

            End Try
        End Function

        Public Shared Function SaveUserProperties(ByVal dt As DataTable) As DataTable
            Try
                Dim DBLayer As New DataAccess
                Return DBLayer.SaveUserProperties(dt)
            Catch ex As Exception
                Throw ex
            Finally

            End Try
        End Function

        Public Shared Function GetUserProperties(ByVal UserID As String) As DataTable
            Try
                Dim DBLayer As New DataAccess
                Return DBLayer.GetUserProperties(UserID)
            Catch ex As Exception
                Throw ex
            Finally

            End Try
        End Function
    End Class

End Namespace
